{smcl}
{txt}{sf}{ul off}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}I:\Sebastian\Statistics\Stata\Stata13\fpa-aidbits-mainfigures.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}29 Jul 2025, 11:00:39
{txt}
{com}. 
. version 13.1
{txt}
{com}. 
. //figure 1
. use fpa-aid_bits_final,clear
{txt}
{com}. keep if oecd_i==1&oecd_j==0
{txt}(1,111,151 observations deleted)

{com}. bys year: egen g_maid=total(commitment_amount_usd_constant_s) if commitment_amount_usd_constant_s!=.
{txt}(723 missing values generated)

{com}. gen g_lnmaid=ln(g_maid) if g_maid!=.
{txt}(6,157 missing values generated)

{com}. su g_lnmaid

{txt}    Variable {c |}        Obs        Mean    Std. dev.       Min        Max
{hline 13}{c +}{hline 57}
{space 4}g_lnmaid {c |}{res}    160,479    24.71494     .442224   23.67127    25.3021
{txt}
{com}. grstyle init
{res}{txt}
{com}. grstyle set plain, nogrid noextend
{txt}
{com}. twoway (line g_lnmaid year,ytitle("OECD aid (ln)")) ///
> (line t_bit year, lcol(gs6)yaxis(2)ytitle("Annual No. of BITs in force", axis(2))ylabel(0 (300) 2400, axis(2))), xtitle(Year) legend(label(1 "Aid") label(2 "BITs")) xsize(4) ysize(3)
{res}{txt}
{com}. 
. graph export f1.pdf, replace
{txt}{p 0 4 2}
file {bf}
f1.pdf{rm}
saved as
PDF
format
{p_end}

{com}. 
. //figure 2 
. use fpa-aid_bits_final,clear
{txt}
{com}. keep if oecd_i==1&oecd_j==0
{txt}(1,111,151 observations deleted)

{com}. grstyle init
{res}{txt}
{com}. grstyle set plain, nogrid noextend
{txt}
{com}. twoway (kdensity lnaid if bit_ratf==1&lnaid!=0, col(gs4)) (kdensity lnaid if bit_ratf==0&lnaid!=0, color(gs12)), ///
> legend (label(1 "BITs") label(2 "No BITs")) xtitle("Aid (ln)") xsize(5) ytitle("Kdensity")
{res}{txt}
{com}. 
. graph export f2-b.pdf, replace
{txt}{p 0 4 2}
file {bf}
f2-b.pdf{rm}
saved as
PDF
format
{p_end}

{com}. 
. //figure 3
. clear
{txt}
{com}. set obs 2
{txt}{p}
Number of observations ({bf:_N}) was 0,
now 2.
{p_end}

{com}. gen id=_n
{txt}
{com}. su id

{txt}    Variable {c |}        Obs        Mean    Std. dev.       Min        Max
{hline 13}{c +}{hline 57}
{space 10}id {c |}{res}          2         1.5    .7071068          1          2
{txt}
{com}. gen coef=9.24
{txt}
{com}. replace coef=5.34 if id==1
{txt}(1 real change made)

{com}. replace coef=9.24 if id==1
{txt}(1 real change made)

{com}. replace coef=5.34 if id==2
{txt}(1 real change made)

{com}. gen lower=5.34-1.96*0.026
{txt}
{com}. gen higher =5.34+1.96*0.026
{txt}
{com}. replace lower=9.24-1.96*0.147
{txt}(2 real changes made)

{com}. replace lower=5.34-1.96*0.026 if id==2
{txt}(1 real change made)

{com}. replace higher=9.24+1.96*0.147 if id==1
{txt}(1 real change made)

{com}. rename coef ate
{res}{txt}
{com}. save bits_aid_ate, replace
{txt}{p 0 4 2}
file {bf}
bits_aid_ate.dta{rm}
saved
{p_end}

{com}. grstyle init
{res}{txt}
{com}. grstyle set plain, nogrid noextend
{txt}
{com}. set obs 3
{txt}{p}
Number of observations ({bf:_N}) was 2,
now 3.
{p_end}

{com}. replace id=0.8 in 3
{txt}(1 real change made)

{com}. twoway (rspike lower higher id, col(gs12))(scatter ate id, msymbol(sh)xlabel(1"BITs" 2"No BITs") xsc(r(1 2))), xsize(4)legend(off)xtitle("") ///
> ytitle (Effects on foreign aid) 
{res}{txt}
{com}. 
. graph export bit-aid-f3.pdf,replace
{txt}{p 0 4 2}
file {bf}
bit-aid-f3.pdf{rm}
saved as
PDF
format
{p_end}

{com}. 
. //figure 4
. use fpa-bitsaid-figure4,clear
{txt}
{com}. 
. grstyle init
{res}{txt}
{com}. grstyle set plain, nogrid noextend
{txt}
{com}. set obs 5
{txt}{p}
Number of observations ({bf:_N}) was 5,
now 5.
{p_end}

{com}. replace x=0.8 in 5
{txt}(0 real changes made)

{com}. twoway (rspike lower higher x if x<=2)(scatter ate x if x<=2,msymbol(Sh))(line ate x if x<=2, xlabel(1"short" 2"long") xsc(r(1 2))), xsize(4)legend(off)xtitle(Time horizon) ///
> ytitle (Average treatment effects) title(Democracies) 
{res}{txt}
{com}. graph save bit-aid-f4a.gph, replace
{res}{txt}file {bf:bit-aid-f4a.gph} saved

{com}. twoway (rspike lower higher x if x>2)(scatter ate x if x>2,msymbol(Sh))(line ate x if x>2, xlabel(3"short" 4"long") xsc(r(2.8 3 4))), xsize(4)legend(off)xtitle(Time horizon)  title(Non-Democracies) 
{res}{txt}
{com}. graph save bit-aid-f4b.gph, replace
{res}{txt}file {bf:bit-aid-f4b.gph} saved

{com}. graph combine bit-aid-f4a.gph bit-aid-f4b.gph
{res}{txt}
{com}. 
. graph export bit-aid-f4.pdf, replace
{txt}{p 0 4 2}
file {bf}
bit-aid-f4.pdf{rm}
saved as
PDF
format
{p_end}

{com}. 
. 
. //figure 5
. use fpa-aid_bits_final, clear
{txt}
{com}. sort dyad year
{txt}
{com}. keep if oecd_i==1&oecd_j==0
{txt}(1,111,151 observations deleted)

{com}. quietly xtivreg2 lnaid l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar (lbit_ratf = l.t_bit) , fe first savefirst cluster(dyad)
{txt}
{com}. predict res, e
{txt}
{com}. gen yhat=lnaid-res
{txt}(69,893 missing values generated)

{com}. gen aid=exp(yhat)
{txt}(69,893 missing values generated)

{com}. grstyle init
{res}{txt}
{com}. grstyle set plain, nogrid noextend
{txt}
{com}. set more off
{txt}
{com}. stripplot yhat, cumul cumprob box centre mcolor(gs13) over(bit_ratf) refline vertical xsize(3)ytitle(Predicted aid (ln)) xtitle(BITs) 
{res}{txt}
{com}. graph export f5.pdf, replace
{txt}{p 0 4 2}
file {bf}
f5.pdf{rm}
saved as
PDF
format
{p_end}

{com}. 
. //figure 6
. ///democracies
> clear
{txt}
{com}. set obs 30
{txt}{p}
Number of observations ({bf:_N}) was 0,
now 30.
{p_end}

{com}. range office_yr 1 30
{txt}
{com}. gen mv=13.5+office_yr*0.37
{txt}
{com}. gen mv_se=sqrt(1.9^2+office_yr^2*0.13^2+2*office_yr*(1.9*0.13*0.8))
{txt}
{com}. gen ub_mv=mv+1.96*mv_se
{txt}
{com}. gen lb_mv=mv-1.96*mv_se
{txt}
{com}. grstyle init
{res}{txt}
{com}. grstyle set plain, nogrid noextend
{txt}
{com}. twoway (line mv office_yr,lp(solid)) (line ub office_yr,lp(dash)) (line lb office_yr,lp(dot)lcol(black)), ///
> legend(off) xtitle(Executive years in office) ytitle(Marginal effect of BITs on foreign aid) title(Democracies)
{res}{txt}
{com}. graph save f6-a.gph,replace
{res}{txt}file {bf:f6-a.gph} saved

{com}. 
. ///non-democracies
> //
. clear
{txt}
{com}. set obs 46
{txt}{p}
Number of observations ({bf:_N}) was 0,
now 46.
{p_end}

{com}. range office_yr 1 46
{txt}
{com}. gen mv=37.6+office_yr*(-0.23)
{txt}
{com}. gen mv_se=sqrt(11.2^2+office_yr^2*0.17^2+2*office_yr*(11.2*0.17*0.75))
{txt}
{com}. gen ub_mv=mv+1.96*mv_se
{txt}
{com}. gen lb_mv=mv-1.96*mv_se
{txt}
{com}. grstyle init
{res}{txt}
{com}. grstyle set plain, nogrid noextend
{txt}
{com}. gen yline=0
{txt}
{com}. twoway (line mv office_yr,lp(solid)) (line ub office_yr,lp(dash)lcol()) (line lb office_yr,lp(dot)lcol(black)) (line yline office_yr,lp(solid)lcol(gs10)lwidth(thin)), ///
> legend(off) xtitle(Executive years in office) ytitle(Marginal effect of BITs on foreign aid) title(Non-Democracies)
{res}{txt}
{com}. graph save f6-b.gph,replace
{res}{txt}file {bf:f6-b.gph} saved

{com}. 
. graph combine f6-a.gph f6-b.gph
{res}{txt}
{com}. 
. graph export f6.pdf, replace
{txt}{p 0 4 2}
file {bf}
f6.pdf{rm}
saved as
PDF
format
{p_end}

{com}. 
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}I:\Sebastian\Statistics\Stata\Stata13\fpa-aidbits-mainfigures.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}29 Jul 2025, 11:37:30
{txt}{.-}
{smcl}
{txt}{sf}{ul off}